﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Umbrella.Whs.WhsAddin.ConsoleControls
{
    public partial class AttentionRequired : ConsoleControlBase
    {
        public AttentionRequired(UmbrellaConsoleTab tab)
            : this(tab, null)
        {
            
        }

        public AttentionRequired(UmbrellaConsoleTab tab, string message)
            : base(tab)
        {
            if (_log.IsDebugEnabled)
                _log.Debug("Initialization start");

            try
            {
                InitializeComponent();

                // set message
                if (!string.IsNullOrEmpty(message))
                {
                    this.messageLabel.Text = string.Format(Properties.Resources.txtAttentionRequired, message);
                }

                // done
                if (_log.IsDebugEnabled)
                    _log.Debug("Initialization done");
            }
            catch (Exception e)
            {
                _log.Fatal("Failed to initialize", e);

                throw;
            }
        }

        private void openSettingsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            _tab.OpenSettings();
        }
    }
}
